package com.mxpio.erp.common.purchase.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.mxpio.erp.common.jpa.model.Order;
import com.mxpioframework.security.annotation.Dict;

import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_PURC_BR")
@Schema(description="请购单")
public class BuyRequestOrder extends Order {
	private static final long serialVersionUID = 1L;

	@Column(name = "BIZ_TYPE_")
	@Schema(description = "单据类型")
    @Dict(dicCode = "ERP_PURC_BR_TYPE")
	private String bizType;

	@Column(name = "APPLY_MAN_")
	@Schema(description = "申请人")
	@Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
	private String applyMan;

	@Column(name = "APPLY_DEPT_")
	@Schema(description = "申请部门")
	@Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
	private String applyDept;

	@Schema(description = "备注")
	@Column(name = "MEMO_")
	private String memo;

	@Schema(description = "审核结论")
	@Column(name = "AUDIT_OPINION_")
	@Dict(dicCode = "ERP_BUY_REQ_AUDIT_OPINION")
	private String auditOpinion;

	@Schema(description = "审核意见")
	@Column(name = "AUDIT_SUGGEST_")
	private String auditSuggest;

	@Schema(description = "审核备注")
	@Column(name = "AUDIT_MEMO_")
	private String auditMemo;

	@Transient
	private List<BuyRequestOrderLine> buyRequestOrders;

	@Override
	public String initTypeCode() {
		return "BR1";
	}
}
